# Economic Risk within the Household and Voting for the Radical Right
# Tarik Abou-Chadi and Thomas Kurer
# World Politics

## REPLICATION FILES

# Figure 1

# Preparation
rm(list = ls()) 
dev.off()
cat("\014")  
# globals
options(scipen=999)
# packages
library(tidyverse)
library(readstata13)
library(texreg)


# set paths (needs to be adjusted before running script)
path <- "..."

setEPS()
postscript(paste0(path, "figure1.eps"))


par(mfrow = c(2, 2), pty="s")
par(mar=c(1.5, 2.5, 1.5, 2))

plot.new()
plot.window(xlim=c(0,10), ylim=c(0,10), xaxs="i", yaxs="i")
#abline(a=2,b=.5, lty=1) # 7
abline(a=2.05,b=.5, lty=2) # 4
abline(a=1.95,b=.5, lty=3) # 4
text(5.5, 6, "Partner: High Risk", cex = 1)
text(5.5, 3.5, "Partner: Low Risk", cex = 1)
axis(1, at=c(10), labels=c("own risk"), cex.axis=1)
axis(2, at=c(10), labels=c("pr(RRP)"), cex.axis=1)
title(main="H0: independent")
box()

plot.new()
plot.window(xlim=c(0,10), ylim=c(0,10), xaxs="i", yaxs="i")
#abline(a=2,b=.5, lty=1) # 7
abline(a=3,b=.5, lty=2) # 4
abline(a=1,b=.5, lty=3) # 4
text(5.5, 7, "Partner: High Risk", cex = 1)
text(6.5, 3, "Partner: Low Risk", cex = 1)
axis(1, at=c(10), labels=c("own risk"), cex.axis=1)
axis(2, at=c(10), labels=c("pr(RRP)"), cex.axis=1)
title(main="H0: additive")
box()

plot.new()
plot.window(xlim=c(0,10), ylim=c(0,10), xaxs="i", yaxs="i")
#abline(a=2,b=.5, lty=1) # 7
abline(a=2,b=.8, lty=2) # 4
abline(a=2,b=.2, lty=3) # 4
text(5, 7.8, "Partner: High Risk", cex = 1)
text(5.5, 2.5, "Partner: Low Risk", cex = 1)
axis(1, at=c(10), labels=c("own risk"), cex.axis=1)
axis(2, at=c(10), labels=c("pr(RRP)"), cex.axis=1)
title(main="H1: pooling")
box()

plot.new()
plot.window(xlim=c(0,10), ylim=c(0,10), xaxs="i", yaxs="i")
#abline(a=2,b=.5, lty=1) # 7
abline(a=6,b=0.1, lty=2) # 4
abline(a=1,b=.6, lty=3) # 4
text(5.5, 7.5, "Partner: High Risk", cex = 1)
text(5.5, 3, "Partner: Low Risk", cex = 1)
axis(1, at=c(10), labels=c("own risk"), cex.axis=1)
axis(2, at=c(10), labels=c("pr(RRP)"), cex.axis=1)
title(main="H2: dominance")
box()

dev.off()